
#ifndef HEIGHT_FIELD_H_
#define HEIGHT_FIELD_H_

#include "superficie.h"

class Generador;

class HeightField : public Superficie {
   private:
      int numX;
      int numY;

      float maxZ;
      float minZ;

      float *z;
      float densidad;

      float *normales;

      void add(int x, int y, float mx, float my) const;
      void construirNormales();

      Generador &gen;

   public:

      HeightField(int numX, int numY, float densidad, Generador &gen) ; 

      int getX() const;
      int getY() const;

      int ancho() const { return getX() - 1; }
      int alto() const { return getY() - 1; }

      float maxHeight() const;
      float minHeight() const;

      Coord operator()(float u, float v) const;
      Coord normal(float u, float v) const;

      const float *data() const;

      virtual void construirZ();

      ~HeightField();
};

#endif
